<?php

namespace app\admin\model;

class CompanyIntroduction extends Common
{
    //

    protected $type = [
        'service_expiration_time' => 'timestamp:Y-m-d',
    ];


    /**
     * 封面图片
     * @return \think\model\relation\BelongsTo
     */
    public function imgFile()
    {
        return $this->belongsTo('Picture', 'img');
    }

    /**
     * 多图
     * @return array|bool|\PDOStatement|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function getImgFiles()
    {
        if (empty($this->imgs)) {
            return [];
        } else {
            return \model('Picture')->where('id', 'in', explode(",", $this->imgs))->select();
        }
    }

    public function admin()
    {
        return $this->hasOne('User', 'company_id');
    }
}
